package com.ls.demo.pattern.factory;

/**
 * @program: simpleframework
 * @description:
 * @author: lishuang
 * @create: 2021-11-19 17:25
 **/

public class GenericDemo {
    public static void handMember(GenericClassExample<? super Integer> genericClassExample) {
        Integer integer = 123 + (Integer) genericClassExample.getMember();
        System.out.println("result is " + integer);
    }

    public static void main(String[] args) {
        GenericClassExample<Number> integerExample = new GenericClassExample<Number>(123);
        GenericClassExample<String> stringExample = new GenericClassExample<>("abc");
        System.out.println(integerExample.getClass());
        System.out.println(stringExample.getClass());
        handMember(integerExample);
        Integer[] integers = {1, 2, 3, 4, 5, 6};
        Double[] doubles = {1.1, 1.2, 1.3, 1.4, 1.5};
        Character[] characters = {'A', 'B', 'C'};
        GenericClassExample.printArray(integers);
        GenericClassExample.printArray(doubles);
        GenericClassExample.printArray(characters);
//        List list = new LinkedList();
//        list.add("words");
//        list.add(1);
//        for (Object o : list) {
//            System.out.println((String) o);
//        }

    }
}
